package com.chinasofti.io;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class Demo06 {
    public static void main(String[] args) throws IOException {
        //读取文件  --  输入流  E:\\aaa\\mn.jpeg
        FileInputStream fis = new FileInputStream("E:\\aaa\\mn.jpeg");
        //写文件    --  输出流 java419\\mn.jpeg
        FileOutputStream fos = new FileOutputStream("java419\\mn.jpeg");

//        int by;
//        while((by = fis.read()) != -1){
//            fos.write(by);
//        }
        //int read(byte[] b)
        byte[] bys = new byte[1024];
        int len;
        while((len = fis.read(bys)) != -1){
            //write(byte[] b, int off, int len)
            fos.write(bys,0,len);
        }

        //释放资源
        fos.close();
        fis.close();
    }
}
